﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace MicropleSoft.WmsServiceLibrary.Util
{
    public class StaticUtil
    {
        /// <summary>
        /// 将单引号转换成双引号，一般在传入条件的时候都要执行此类检查。
        /// </summary>
        /// <param name="originalString"></param>
        /// <returns></returns>
        public static string ConvertInjectString(string originalString)
        {
            if(string.IsNullOrEmpty(originalString))
                return string.Empty;
            return originalString.Replace("'", "''");
        }

        public static EntityState TranslateState(DomainEntityState domainEntityState)
        {
            if (domainEntityState == DomainEntityState.None)
                return EntityState.Unchanged;
            else if (domainEntityState == DomainEntityState.Added)
                return EntityState.Added;
            else if (domainEntityState == DomainEntityState.Updated)
                return EntityState.Modified;
            else if (domainEntityState == DomainEntityState.Deleted)
                return EntityState.Deleted;
            else 
                return EntityState.Unchanged;
        }
   
    }
}
